package com.zhy.generator.codegen.mybatis.javarequest.elements;
import com.zhy.generator.codegen.dom.java.*;
import com.zhy.generator.codegen.mybatis.javarequest.RequestInnerClassConstant;

/**
 * @author 源
 */
public class ListParamInnerClassGenerator extends AbstractJavaRequestInnerClassGenerator {
    @Override
    public void addInterfaceElements(TopLevelClass tlc) {
        InnerClass ic = new InnerClass(RequestInnerClassConstant.LIST_PARAM);
        ic.setVisibility(JavaVisibility.PUBLIC);
        ic.setStatic(true);
        tlc.addInnerClass(ic);

        //添加实现类
        ic.addSuperInterface(getSuperInterface());

        //serialVersionUID
        addSerialVersionUIDField(ic);

        //Data注解
        addDataAnnotation(tlc,ic);

        //APiModel注解
        addApiModelAnnotation(tlc,ic);

        FullyQualifiedJavaType fqjt = new FullyQualifiedJavaType("java.lang.Integer");
        tlc.addImportedType(fqjt);

        Field field = new Field();
        field.setVisibility(JavaVisibility.PRIVATE);
        field.setType(fqjt);
        field.setName("pageIndex");
        addFieldAnnotation(tlc,field,"页数",true);
        ic.addField(field);

        Field prow = new Field();
        prow.setVisibility(JavaVisibility.PRIVATE);
        prow.setType(fqjt);
        prow.setName("pageSize");
        addFieldAnnotation(tlc,prow,"每页行数",true);
        ic.addField(prow);

    }
}
